package com.boxfishedu.index;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by lzx on 2016/12/13.
 */
@Service
public class FooService {

    @Autowired
    private FooJpaRepository fooJpaRepository;

    // 测试单一唯一索引
    public void fooSingleUnique() {
        for (int i = 0; i < 2; i++) {
            Foo foo = new Foo();
            foo.setUsername("lzx");
            fooJpaRepository.save(foo);
        }
    }

    // 测试联合唯一索引
    public void fooUnionUnique() {
        for (int i = 0; i < 2; i++) {
            Foo foo = new Foo();
            foo.setDog("小黑");
            foo.setTail("1");
            fooJpaRepository.save(foo);
        }

    }

}
